package cn.com.xuan.service.impl;

import cn.com.xuan.dao.UserVORepository;
import cn.com.xuan.dao.bean.UserVO;
import cn.com.xuan.service.UserVOService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserVOServiceImpl implements UserVOService {

    @Autowired
    UserVORepository userVORepository;

    public UserVO insertOV(UserVO userVO){
        return userVORepository.save(userVO);
    }
    @Transactional
    public List<UserVO> insertOVBatch(List<UserVO> userVOs){
        List<UserVO> lsData = new ArrayList<UserVO>();
        for (UserVO userVO:userVOs
             ) {
            userVO = userVORepository.save(userVO);
            lsData.add(userVO);
        }
        return lsData;
    }
}
